package svc

import (
	"github.com/zeromicro/go-zero/rest"
	"github.com/zeromicro/go-zero/zrpc"
	"hotel/api/internal/config"
	"hotel/api/internal/middleware"
	"hotel/userrpc/userrpcclient"
)

type ServiceContext struct {
	Config           config.Config
	UserRpc          userrpcclient.Userrpc
	UserXxMiddleware rest.Middleware
}

func NewServiceContext(c config.Config) *ServiceContext {
	return &ServiceContext{
		Config:           c,
		UserRpc:          userrpcclient.NewUserrpc(zrpc.MustNewClient(c.UserRpc)),
		UserXxMiddleware: middleware.NewUserXxMiddleware().Handle,
	}
}
